package com.chenshanji.lease.common.obs;

import com.obs.services.ObsClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(ObsProperties.class)
@ConditionalOnProperty(name = "obs.endpoint")

public class ObsConfiguration {
    @Autowired
    private ObsProperties properties;

    @Bean
    public ObsClient obsClient(){
        return new ObsClient(properties.getAk(), properties.getSk(),properties.getEndpoint());
    }
}
